package com.gxa.meiye.admin.controller.zy;

import com.gxa.meiye.admin.service.DoorService;
import com.gxa.meiye.core.common.JsonResult;
import com.gxa.meiye.core.pojo.domain.Settle;
import com.gxa.meiye.core.pojo.domain.Therapist;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.spring.web.json.Json;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Author: zy
 * @CreateTime: 2022-07-20  16:27
 */
@RestController
@Api(value="上门服务",tags = "上门服务接口")
@RequestMapping("/door")
public class DoorController {
    @Autowired
    private DoorService doorService;
   //美疗师
   //@ApiOperation("查看美疗师")
    @GetMapping("/searchBeauty1")
    public Map searchBeauty(Integer[] ids){
       for (int i=0;i<ids.length;i++){
           System.out.println(ids[i]);
       }
        Integer money=100;
       BigDecimal bigDecimal=new BigDecimal(money.toString());


       doorService.Str(ids);
       System.out.println("0位置是"+ids[0]);
       System.out.println("1位置是"+ids[1]);
       System.out.println("2位置是"+ids[2]);
//       List<Therapist> select = doorService.select();
//       JsonResult jsonResult=new JsonResult();
//       if (!StringUtils.isEmpty(select)){
//           jsonResult.setCode("1");
//           jsonResult.setMsg("查询成功");
//           jsonResult.setData(select);
//       }
//        return jsonResult.getMap();
       return null;
    }
    @ApiOperation("查看美疗师")
    @GetMapping("/searchBeauty")
    public Map searchBeauty(){
//        for (int i=0;i<ids.length;i++){
//            System.out.println(ids[i]);
//        }
//        System.out.println("0位置是"+ids[0]);
//        System.out.println("1位置是"+ids[1]);
//        System.out.println("2位置是"+ids[2]);
       List<Therapist> select = doorService.select();
       JsonResult jsonResult=new JsonResult();
       if (!StringUtils.isEmpty(select)){
           jsonResult.setCode("1");
           jsonResult.setMsg("查询成功");
           jsonResult.setData(select);
       }
        return jsonResult.getMap();

    }
    //查询美疗师信息
    @ApiOperation("美疗师信息")
    @GetMapping("/Beauty")
    public Map Beauty(String name){
        Therapist therapist = doorService.selectBeauty(name);
        JsonResult jsonResult=new JsonResult();
        if (therapist!=null){
            jsonResult.setCode("1");
            jsonResult.setMsg("查询成功");
            jsonResult.setData(therapist);
        }
        return jsonResult.getMap();
    }
    //查询美疗师项目
    @ApiOperation("美疗师项目")
    @GetMapping("/item")
    public Map item(String name){
        Therapist therapist = doorService.selectBeautyProject(name);
        JsonResult jsonResult=new JsonResult();
        if (!StringUtils.isEmpty(therapist)){
            jsonResult.setCode("1");
            jsonResult.setMsg("查询成功");
            jsonResult.setData(therapist);
        }
        System.out.println(therapist);
        return jsonResult.getMap();
    }
    //查询项目评论
    @ApiOperation("项目评论")
    @GetMapping("/search")
    public Map search(String name){
        Settle settle = doorService.selectCon();
        JsonResult jsonResult=new JsonResult();
        if (settle!=null){
            jsonResult.setCode("1");
            jsonResult.setData(settle);
        }
        return jsonResult.getMap();
    }

}
